import {
  getUserpatientsList
} from "../../assets/js/servicePatient.js";

Page({
  data: {
    noList: {
      img: "/assets/img/nofwhz.png",
      text: "您还没有可选服务患者~"
    },
    list: [
      // {
      //   name: "张三",
      //   sex: "男",
      //   relationship: "朋友"
      // },
      // {
      //   name: "李四",
      //   sex: "女",
      //   relationship: "父母"
      // }
    ]
  },

  onLoad: function(options) {},

  onReady: function() {},

  onShow: function() {
    this.getList();
  },
  // 获取用户的添加过的服务患者
  getList: function() {
    getUserpatientsList().then(list => {
      this.setData({
        list
      })
    })
  },
  // 编辑服务患者
  editContacts: function(e) {
    wx.navigateTo({
      url: `/pages/u_updateServicePatients/u_updateServicePatients?type=edit&patientId=${e.detail.patientId}`,
    })
  },
  // 添加服务患者
  addContacts: function() {
    wx.navigateTo({
      url: "/pages/u_updateServicePatients/u_updateServicePatients?type=add",
    })
  }
})